/*---头部导航开始---*/


var head = document.querySelector('#head');
var nav_link = document.querySelectorAll('#nav');
var toTop = document.querySelector(".top-1");
var img1 = document.querySelector("#img1");
console.log(document.documentElement.scrollTop || document.body.scrollTop);
window.onscroll = function(){
    if(document.documentElement.scrollTop || document.body.scrollTop > 500){
        if(toTop !== null){
              toTop.style.display = "block";
            
        }
       
        if(img1 !== null){
         img1.src="img/shouye-1.png";
        }
        
        if(head != null){
            head.style.backgroundColor = '#fff';
        }
        
        
        for(var i = 0; i < nav_link.length; i++){
            nav_link[i].style.color = '#000';
        }
    }else{
        if(toTop != null){
            toTop.style.display = "none";
            }
        if(head != null){
            head.style.backgroundColor = 'rgba(255,255,255,0)';
        }
       
        if(img1 !== null){
        img1.src="img/shouye-37.png";
        }
        
        
        for(var i = 0; i < nav_link.length; i++){
            nav_link[i].style.color = 'rgba(255,255,255)';

        }

    }
}
/*--返回顶部--*/
if(toTop != null){
toTop.addEventListener('click',function(){
    window.scrollTo({
        top:0,
        behavior:'smooth'
    });
});
}
/*---头部导航结束---*/


/*-----选项卡-----*/

/*------轮播图-----*/
var mySwiper = new Swiper ('.swiper-container', {
    loop: true, // 循环模式选项
    autoplay:true,

    // 如果需要分页器
    pagination: {
        el: '.swiper-pagination',
    },

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },

});





var swiper1 = new Swiper('.swiper-container1', {
    direction: 'vertical',
    autoplay:true,
    pagination: {
        el: '.swiper-pagination',   
        clickable: true,
    },
});






/*--隐藏---*/
var top1 = document.querySelector(".Top");
if(top1 != null){
top1.addEventListener('mouseover',function(){
    top1.style.right = "0";
    top1.style.transition="all 0.5s linear"
});
top1.addEventListener('mouseleave',function(){
    top1.style.right = "-89px";
    top1.style.transition="all 0.5s linear"
});
};


/*-轮播--*/
  var mySwiper = new Swiper ('.swiper-container2', {
    loop: true, // 循环模式选项
     autoplay:true,
    // 如果需要分页器
    pagination: {
      el: '.swiper-pagination',
    },
    
    // 如果需要前进后退按钮
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },
    
  }); 


var kkk = document.querySelector("#kkk");
if(kkk != null){
    var kkk = new Vue({
      el:"#app",
      data:{
          message:"请求数据",
      },
      mounted(){
      axios
        .get('../json/news.json')
        .then(response => this.message = response.data.lists)
        .catch(function(error){
                console.log(error)
        })
  }
  });
}



  
  
